
<div class="container">
  <!DOCTYPE html>
<html lang="zh-cn">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">




<title>Node.js | Miles`s</title>

<link rel="stylesheet" href="https://mada.gitee.io/notes//css/styles.css">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" 
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/zenburn.min.css" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="https://mada.gitee.io/notes//js/highlight.js"></script>






  <div class="container">
    <nav class="navbar level">
      <div class="navbar-brand">
          <a class="nav-item" href="https://mada.gitee.io/notes/"><h1 class="title is-3">Miles`s</h1></a>
      </div>           
      <div class="navbar-menu has-text-centered is-active">
          <div class="navbar-end is-centered">
              
           </div>
      </div>
    </nav>
  </div>
  <main class="container">
      
      
      <h1 class="title is-3">2016</h1>
      
      <article class="columns">
        <div class="column is-2">
          <h6 class="is-inline" style="white-space: nowrap">Jun 21</h2>
        </div>
        <div class="column">
          <h2 class="subtitle is-inline is-size-4-mobile is-size-3-desktop"><a href="https://mada.gitee.io/notes/posts/process/">process</a></h1>
          <div class="content is-hidden-mobile">
            process 对象 process 对象是Node的一个全局对象，提供当前Node进程的信息。 它可以在脚本的任意位置使用，不必通过require命令加载。该对象部署了EventEmitter接口。
进程信息 退出码 进程退出时，会返回一个整数值，表示退出时的状态。
 0 正常退出 1 发生未捕获错误 5 v8执行错误 8 不正确的参数 128+信号值。  属性 process对象提供一系列属性，用于返回系统信息
 process.argv 返回当前进程的命令行参数数组 process.env 返回一个对象，成员为当前shell的环境变量。 如process.env.HOME process.installPrefix node安装路径的前缀 process.pid 当前进程的进程号 process.platform 平台 Linux process.title 默认值为 node …
            
            <br>
            <a class="button is-marginless is-paddingless" href="https://mada.gitee.io/notes/posts/process/">
            <span class="icon-link is-small" style="line-height: 100%">
                <i class="fa fa-angle-double-right" aria-hidden="true"></i>
              </span>
              <p style="padding:0 5px"></p>more</p>
            </a>
            
          </div>
      </article>
      
      <article class="columns">
        <div class="column is-2">
          <h6 class="is-inline" style="white-space: nowrap">Jun 21</h2>
        </div>
        <div class="column">
          <h2 class="subtitle is-inline is-size-4-mobile is-size-3-desktop"><a href="https://mada.gitee.io/notes/posts/npm/">npm</a></h1>
          <div class="content is-hidden-mobile">
            npm install npm install npm@latest -g
npm init npm init -y
跳过提问阶段
npm set 设置环境变量
npm info packagename 列出模块信息
npm search 搜索仓库。
npm list npm install 安装不同版本
	npm install sax@latest npm install sax@0.1.1 npm install sax@&quot;&gt;=0.1.0 &lt;0.2.2&quot;  避免系统权限 修改主目录下 .npmrc文件
prefix = /home/yourUsername/npm
mkdir ~/npm
在.bash_profile export PATH=~/npm/bin:$PATH
npm run 参数 使用－－ 传参数
npm run test -- 300 …
            
            <br>
            <a class="button is-marginless is-paddingless" href="https://mada.gitee.io/notes/posts/npm/">
            <span class="icon-link is-small" style="line-height: 100%">
                <i class="fa fa-angle-double-right" aria-hidden="true"></i>
              </span>
              <p style="padding:0 5px"></p>more</p>
            </a>
            
          </div>
      </article>
      
      <article class="columns">
        <div class="column is-2">
          <h6 class="is-inline" style="white-space: nowrap">Jun 21</h2>
        </div>
        <div class="column">
          <h2 class="subtitle is-inline is-size-4-mobile is-size-3-desktop"><a href="https://mada.gitee.io/notes/posts/node-%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91/">node 命令行程序开发</a></h1>
          <div class="content is-hidden-mobile">
            [TOC]
node 命令行程序开发 可执行脚本 将执行文件写入 package.json
{ &quot;name&quot;: &quot;hello&quot;, &quot;bin&quot;: { &quot;hello&quot;: &quot;hello&quot; } }  然后执行 npm link命令
然后再执行hello，就不用再单独输入路径。
命令行参数原始写法 console.log('hello', process.argv[2])  process.argv 第一个参数默认是 node 第二个参数是执行路径 第三个开始是用户输入部分。
通过child_process 模块新建子进程，从而执行unix系统命令 var name = process.argv[2] var exec = require('child_process').exec var child …
            
            <br>
            <a class="button is-marginless is-paddingless" href="https://mada.gitee.io/notes/posts/node-%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91/">
            <span class="icon-link is-small" style="line-height: 100%">
                <i class="fa fa-angle-double-right" aria-hidden="true"></i>
              </span>
              <p style="padding:0 5px"></p>more</p>
            </a>
            
          </div>
      </article>
      
      
      
  </main>
  <section class="section">
  <div class="container">
    <nav class="level is-mobile">
      <div class="level-left">
        <div class="level-item">
          
          <a class="button is-rounded" disabled>
            <span class="icon is-small is-marginless">
              <i class="fa fa-angle-left"></i>
            </span>
            上一页
          </a>
          
        </div>
      </div>
      <div class="level-right is-marginless">
        <div class="level-item">
          
          <a class="button is-rounded" disabled>
            下一页
            <span class="icon is-small is-marginless">
              <i class="fa fa-angle-right"></i>
            </span>
          </a>
          
        </div>
      </div>
    </nav>
  </div>
</section>

  <section class="section">
  <div class="container has-text-centered">
    <p></p>
  </div>
</section>


</div>